<?php
# $Id: default_index.tmpl.php,v 1.3 2006/06/22 14:45:39 diegor Exp $
require_once(APP_LIB_DIR . 'Sajax.php');
require_once(APP_LIB_DIR . 'DBAccessModel.class.php');
require_once('utils.inc.php');

$auth = $user->getAttribute('auth');
$stats = $template['stats'];
$posts = $template['posts'];
$logged = $template['logged'];

function getlist($p='',$search='',$by='1',$s='DESC') { 
    $a = new PromosAction();
    parse_str($search,$res);
    return $a->getlist($p,$res,$by,$s); 
}
function lookup($what=''){
    $l = new PromosAction();
    return $l->lookup($what);
}
function save($detail='',$id='',$id1='',$id2='',$action=''){
    $s = new PromosAction();
    parse_str($detail,$res);
    return $s->save($res,$id,$id1,$id2,$action);
}

sajax_init();
//$sajax_debug_mode = 1;
sajax_export('getlist');
sajax_export('lookup');
sajax_export('save');
sajax_handle_client_request();
$sajax_request_type = 'POST';
require_once('header.php'); 
$mm = new MessagingModel('Messaging');
$smsc= $mm->smsc();
?>
<script language="JavaScript" type="text/javascript">

<?php sajax_show_javascript();?>

var s = "ASC";
var b = 1;

function page(p) {
    st = $('form1').toQueryString();
    load();
    x_getlist(p,st,b,s,getlist_cb)
}
function sort(by){
    s = (s=="DESC") ? "ASC" : "DESC";
    st = $('form1').toQueryString();
    p = $('pagenum');
    p = (p) ? p.value : 1;
    b = by;
    load();
    x_getlist(p,st,b,s,getlist_cb)
}
function filter(){
    st = $('form1').toQueryString();
    p = 1
    //st = Json.toString(st);
    load();
    x_getlist(p,st,b,s,getlist_cb);
}
function sendmsg(smsc){
//data = $('form2').toQueryString();

if (smsc=="smart60"){
to="258";
msg="60";
smsc="smart";
    x_save('',to,msg,smsc,'send_msg', function(new_data1){
      Json_eval(new_data1);
      alert("SMART Unlimited Text Registration for 5days has been send");
    });
}else if(smsc=="smart30"){
to="258";
msg="30";
smsc="smart";
    x_save('',to,msg,smsc,'send_msg', function(new_data1){
      Json_eval(new_data1);
      alert("SMART Unlimited Text Registration for 2days has been send");
    });
}else if(smsc=="smart15"){
to="258";
msg="15";
smsc="smart";
    x_save('',to,msg,smsc,'send_msg', function(new_data1){
      Json_eval(new_data1);
      alert("SMART Unlimited Text Registration for 1day has been send");
   });
}else if(smsc=="globe80"){
to="8888";
msg="UNLITXT80";
smsc="globe";
    x_save('',to,msg,smsc,'send_msg', function(new_data1){
      Json_eval(new_data1);
      alert("GLOBE Unlimited Text Registration for 5days has been send");
    });
}else if(smsc=="globe40"){
to="8888";
msg="UNLITXT40";
smsc="globe";
    x_save('',to,msg,smsc,'send_msg', function(new_data1){
      Json_eval(new_data1);
      alert("GLOBE Unlimited Text Registration for 2days has been send");
    });
}else if(smsc=="globe20"){
to="8888";
msg="UNLITXT20";
smsc="globe";
    x_save('',to,msg,smsc,'send_msg', function(new_data1){
      Json_eval(new_data1);
      alert("GLOBE Unlimited Text Registration for 1days has been send");
   });
}
}

function submitthis()
{
    document.adminForm.submit();
}
</script>
<link rel="stylesheet" href="<?=WEB_MODULE_DIR?>css/structure2.css" type="text/css" />
<link rel="stylesheet" href="<?=WEB_MODULE_DIR?>css/form2.css" type="text/css" />
<body>
<form action="?module=<?=DEFAULT_MODULE?>&action=DefaultIndex" method="post" name="adminForm">
<table width="100%" class="menubar" cellpadding="0" cellspacing="0" border="0">
    <tr>
        <td class="menudottedline" width="40%">
            <div class="pathway"><font size="2px" color="#000033"><b><?=$config['version']?></b></font></div>       
        </td>
        <td class="menudottedline" align="right">
            <table cellpadding="0" cellspacing="0" border="0" id="toolbar">
                <tr height="60" valign="middle" align="center">
                    <td>
                        <a class="toolbar" href="#">
                        <img src="<?=WEB_MODULE_DIR?>images/help_f2.png" 
                             align="middle" name="new" border="0"><br>Help
                        </a>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
</table>
<br>
<br>
<div align="center" class="centermain">
    <div class="main">
        <table class="adminheading">
            <tr>
                <th class="cpanel" rowspan="2" nowrap>Unlimited Text Promos&nbsp;<font size="1px" color="#CCCCCC">[<?=strtoupper($auth['privilege'])?>]</font></th>
            </tr>
        </table>

        <table class="adminform">
            <tr>
                <!-- SYSTEM SHORTCUTS  -->
                <td width="50%" valign="top">
                    <div id="cpanel">
                        <div style="float: left">
                            <div class="icon">
                                <a class="toolbar" href="?module=<?=DEFAULT_MODULE?>&action=DefaultIndex">
                               <!-- <a class="toolbar" href="javascript: document.getElementById('flag').value='new'; submitthis();">-->
                                <img src="<?=WEB_MODULE_DIR?>images/frontpage.png" 
                                     align="middle" name="new" border="0"><br>Main
                                </a>
                            </div>
                        </div>
                        <div style="float: left">
                            <div class="icon">
                               <a class="toolbar" href="javascript: sendmsg('smart60');">
                                <!--<a class="toolbar" href="javascript: smart_inquiry();">-->
                                <img src="<?=WEB_MODULE_DIR?>images/smart60.png" align="middle" name="new" border="0"><br>UNLItxt<br>(5days)</a>
                            </div>
                        </div>
                        <div style="float: left">
                            <div class="icon">
                               <a class="toolbar" href="javascript: sendmsg('smart30');">
                                <!--<a class="toolbar" href="javascript: smart_inquiry();">-->
                                <img src="<?=WEB_MODULE_DIR?>images/smart30.png" align="middle" name="new" border="0"><br>UNLItxt<br>(2days)</a>
                            </div>
                        </div>
                        <div style="float: left">
                            <div class="icon">
                               <a class="toolbar" href="javascript: sendmsg('smart15');">
                                <!--<a class="toolbar" href="javascript: smart_inquiry();">-->
                                <img src="<?=WEB_MODULE_DIR?>images/smart15.png" align="middle" name="new" border="0"><br>UNLItxt<br>(1days)</a>
                            </div>
                        </div>
                        <div style="float: left">
                            <div class="icon">
                               <a class="toolbar" href="javascript: sendmsg('globe80');">
                               <!-- <a class="toolbar" href="javascript: globe_inquiry();">-->
                                <img src="<?=WEB_MODULE_DIR?>images/globe80.png" 
                                     align="middle" name="new" border="0"><br>UNLItxt<br>(5day)
                                </a>
                            </div>
                        </div>
                        <div style="float: left">
                            <div class="icon">
                               <a class="toolbar" href="javascript: sendmsg('globe40');">
                               <!-- <a class="toolbar" href="javascript: globe_inquiry();">-->
                                <img src="<?=WEB_MODULE_DIR?>images/globe40.png" 
                                     align="middle" name="new" border="0"><br>UNLItxt<br>(2day)
                                </a>
                            </div>
                        </div>
                        <div style="float: left">
                            <div class="icon">
                               <a class="toolbar" href="javascript: sendmsg('globe20');">
                               <!-- <a class="toolbar" href="javascript: globe_inquiry();">-->
                                <img src="<?=WEB_MODULE_DIR?>images/globe20.png" 
                                     align="middle" name="new" border="0"><br>UNLItxt<br>(1day)
                                </a>
                            </div>
                        </div>
                    </div>
                </td>
            </tr>
        </table>
    </div>
</div>
<?php require('footer.php'); ?>
